home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
graphics
/
font3d10.zip
/
TrueType.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-15
|
5KB
|
234 lines
//=================================================================================================
// TrueType.H
//
// Copyright (c) 1994 by Todd A. Prater
// All rights reserved.
//
//=================================================================================================
#ifndef __TrueType_H__
#define __TrueType_H__
#include "Config.H"
#include "Geometry.H"
#define OFFSET_TABLE_SIZE 12
class TTTableEntry
{
public:
ULONG tag;
ULONG checkSum;
ULONG offset;
ULONG length;
TTTableEntry(void)
{
tag = 0x00000000;
checkSum = 0;
offset = 0;
length = 0;
}
};
class TTPoint
{
public:
SHORT type;
LONG x;
LONG y;
TTPoint(void)
{
type=ON_CURVE;
x=0;
y=0;
}
TTPoint(SHORT _type, LONG _x, LONG _y)
{
type=_type;
x=_x;
y=_y;
}
TTPoint(TTPoint& point)
{
type=point.type;
x=point.x;
y=point.y;
}
};
class TTContour
{
public:
USHORT numPoints;
TTPoint* points;
TTContour(void)
{
numPoints=0;
points=NULL;
}
};
class TTGlyph
{
public:
SHORT numContours;
SHORT xMin;
SHORT yMin;
SHORT xMax;
SHORT yMax;
TTContour* contours;
TTGlyph(void)
{
numContours=0;
contours=NULL;
}
};
class TTFont
{
USHORT numGlyphs;
TTGlyph* glyphs;
USHORT maxPoints;
USHORT maxContours;
USHORT unitsPerEm;
CHARPTR copyrightString;
CHARPTR familyString;
CHARPTR subfamilyString;
CHARPTR idString;
CHARPTR fullnameString;
CHARPTR versionString;
CHARPTR psnameString;
CHARPTR trademarkString;
USHORT characterMap[256];
void printbits(BYTE byte);
public:
TTFont(CHARPTR filename);
CHARPTR Copyright(void) { return copyrightString; }
CHARPTR Family(void) { return familyString; }
CHARPTR Subfamily(void) { return subfamilyString; }
CHARPTR UniqueID(void) { return idString; }
CHARPTR FullName(void) { return fullnameString; }
CHARPTR Version(void) { return versionString; }
CHARPTR PSName(void) { return psnameString; }
CHARPTR Trademark(void) { return trademarkString; }
USHORT CharacterMap(int c) { return characterMap[c]; }
USHORT UnitsPerEm(void) { return unitsPerEm; }
USHORT NumGlyphs(void)
{
return numGlyphs;
}
SHORT NumContours(USHORT glyphnum)
{
if (numGlyphs!=0 && glyphnum<numGlyphs)
return glyphs[glyphnum].numContours;
else
return 0;
}
USHORT NumPoints (USHORT glyphnum, USHORT contournum)
{
if( glyphnum<numGlyphs
&& glyphs[glyphnum].numContours>0
&& contournum<glyphs[glyphnum].numContours)
return glyphs[glyphnum].contours[contournum].numPoints;
else
return 0;
}
LONG FontPointX (USHORT glyphnum, USHORT contournum, USHORT pointnum)
{
if( glyphnum<numGlyphs
&& glyphs[glyphnum].numContours>0
&& contournum<glyphs[glyphnum].numContours
&& glyphs[glyphnum].contours[contournum].numPoints!=0
&& glyphs[glyphnum].contours[contournum].numPoints!=0 )
return glyphs[glyphnum].contours[contournum].points[pointnum].x;
else
return 0;
}
LONG FontPointY (USHORT glyphnum, USHORT contournum, USHORT pointnum)
{
if( glyphnum<numGlyphs
&& glyphs[glyphnum].numContours>0
&& contournum<glyphs[glyphnum].numContours
&& glyphs[glyphnum].contours[contournum].numPoints!=0 )
return glyphs[glyphnum].contours[contournum].points[pointnum].y;
else
return 0;
}
SHORT FontPointType (USHORT glyphnum, USHORT contournum, USHORT pointnum)
{
if( glyphnum<numGlyphs
&& glyphs[glyphnum].numContours>0
&& contournum<glyphs[glyphnum].numContours
&& glyphs[glyphnum].contours[contournum].numPoints!=0 )
return glyphs[glyphnum].contours[contournum].points[pointnum].type;
else
return NO_POINT;
}
SHORT GlyphXMin(USHORT glyphnum)
{
if (glyphnum<numGlyphs)
return glyphs[glyphnum].xMin;
else
return 0;
}
SHORT GlyphYMin(USHORT glyphnum)
{
if (glyphnum<numGlyphs)
return glyphs[glyphnum].yMin;
else
return 0;
}
SHORT GlyphXMax(USHORT glyphnum)
{
if (glyphnum<numGlyphs)
return glyphs[glyphnum].xMax;
else
return 0;
}
SHORT GlyphYMax(USHORT glyphnum)
{
if (glyphnum<numGlyphs)
return glyphs[glyphnum].yMax;
else
return 0;
}
void Print(void);
};
#endif